package com.qiaofang.applet.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Date;

/**
 * 房源排序
 *
 * @author daiyuxiang
 */
@Getter
@AllArgsConstructor
public enum PropertySortConstants {

    UPDATE_TIME_DESC(0, "updateTime_desc"),
    SELL_PRICE_ASC(1, "sellPrice_asc"),
    SELL_PRICE_DESC(2, "sellPrice_desc"),
    SELLUNITPRICE_ASC(3, "sellUnitPrice_asc"),
    SELLUNITPRICE_DESC(4, "sellUnitPrice_desc"),
    SQUARE_ASC(5, "square_asc"),
    SQUARE_DESC(6, "square_desc"),
    AVERAGEPRICE_ASC(7,"averagePrice_asc"),
    AVERAGEPRICE_DESC(8,"averagePrice_desc"),
    RENT_PRICE_ASC(9,"rentPrice_asc"),
    RENT_PRICE_DESC(10,"rentPrice_desc");

    private int code;

    private String value;

    public static PropertySortConstants getValueByCode(Integer code) {

        for (PropertySortConstants item : values()) {
            if (item.getCode() == code) {
                return item;
            }
        }
        return null;
    }

}
